#include<iostream>
#include<cmath>
#define pi 3.1415926
using namespace std;
int n=10000; 
double fun1(double x)
{
	double w=4/(1+x*x);
	return w;
}
double fun2(double x)
{
	double w=sqrt(1+x*x);
	return w;
}
double fun3(double x)
{
	double w=sin(x);
	return w;
}
double integral(double a,double b,double(*p)(double x))
{
	long double h,t1,t2=0,tn;
	h=(b-a)/n;
	t1=((*p)(a)+(*p)(b))*h/2;
	for(int i=1;i<n;i++)
	{
		t2=t2+h*(*p)(a+i*h);
	}
	//cout<<t1<<t2<<endl;//
	tn=t1+t2;
	return tn;
}
int main()
{
	double Tn1=integral(0,1,fun1);
	double Tn2=integral(1,2,fun2);
	double Tn3=integral(0,pi/2,fun3);
	cout<<Tn1<<"\n"<<Tn2<<"\n"<<Tn3<<endl;
	return 0;
} 
